UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7gAfWtDRv+khgMiUHjYkUcpcHRV0CCzDV357TBQPHaM=' 
WHERE 
  key_id = 'f671d818b7a229a49ea29cc005e92b42b350de6700ec9cef1af645a9671468bb' 
  AND (
    token = '7gAfWtDRv+khgMiUHjYkUcpcHRV0CCzDV357TBQPHaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032