UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OhVDF5h9HnpwhrTQxekf6uHqpk739VANleBCj3LdwAI=' 
WHERE 
  key_id = '9f78e6585b04c083c2566c136ac73bc9098de6d01388bcdf98bd0596bccd234b' 
  AND (
    token = 'OhVDF5h9HnpwhrTQxekf6uHqpk739VANleBCj3LdwAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042