UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f0LGu5kbDutnkhRjCWRiXrcC0590yoMDL2UIBG9pjas=' 
WHERE 
  key_id = '3089942cb20937a2dedee1d700480c05c99d5dd816ed82b4c60c5131b739f280' 
  AND (
    token = 'f0LGu5kbDutnkhRjCWRiXrcC0590yoMDL2UIBG9pjas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021