UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4cYpM8ZhQW4sSbw3IlDxYDqVe8S0+0Ej7xmoRV/nNT8=' 
WHERE 
  key_id = 'e711e5c58d8868909043b7cc413e019066fac84a855cde343d6f85080c355cfb' 
  AND (
    token = '4cYpM8ZhQW4sSbw3IlDxYDqVe8S0+0Ej7xmoRV/nNT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027