UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i02T2ltZ7eMARmvJjRyfcIy1qPdBCeXwAefn5pgZvf0=' 
WHERE 
  key_id = 'bb385a893281f253b04e3a047e5c9bb767161fe34095fe6414cda52a54a54c69' 
  AND (
    token = 'i02T2ltZ7eMARmvJjRyfcIy1qPdBCeXwAefn5pgZvf0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014