UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HrF+NhQb9HuIBBf8JdAw1z+gtorPo6HIj4aGdq1mJAs=' 
WHERE 
  key_id = 'c7049797011e5c01270e654c9bb08f7672cdc217ea63526b85f5fd102178e1ef' 
  AND (
    token = 'HrF+NhQb9HuIBBf8JdAw1z+gtorPo6HIj4aGdq1mJAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031