UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p4oSDVRfOUpla8nBsK6wTCeARggRg2kh+05YuEI8SmE=' 
WHERE 
  key_id = 'b4a82efcc35118788d91fa6e70e392947ddb0fe182c5cc33167ab217e1dae0e6' 
  AND (
    token = 'p4oSDVRfOUpla8nBsK6wTCeARggRg2kh+05YuEI8SmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043