UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KRE5PHlxxq1c3ZwJPIXV4O/hk416cdsLIsmauyDOlro=' 
WHERE 
  key_id = '5403ad71664c31a3a3a3d518435c737d2e151bb646c51385b83eef53e6a0d465' 
  AND (
    token = 'KRE5PHlxxq1c3ZwJPIXV4O/hk416cdsLIsmauyDOlro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036