UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U3pNfXgACgJgG67c6oaNrivqo8c1asYCN35YyOZbn9Y=' 
WHERE 
  key_id = '022bc4c97d516a9d5528aba72761c9fc304e854939f95814728173f64b7ffff5' 
  AND (
    token = 'U3pNfXgACgJgG67c6oaNrivqo8c1asYCN35YyOZbn9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040