UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rqbCL/ol1bhJEPeu7HjAJBv4DhvS4UaBVVM/YU41qv0=' 
WHERE 
  key_id = '846a1e8bf20e86143b58d2ec4cfbe080c63935aa15c7d64ef5be57201238a038' 
  AND (
    token = 'rqbCL/ol1bhJEPeu7HjAJBv4DhvS4UaBVVM/YU41qv0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033