UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQKRlKqmmltlKaNqRtpDpAg7/Yrq25Pseo8TB1cfrLA=' 
WHERE 
  key_id = '0c4583ee0896f0780554532ea7405a35d1b59cfa077b43bbbd3fe1bdaa38b206' 
  AND (
    token = 'iQKRlKqmmltlKaNqRtpDpAg7/Yrq25Pseo8TB1cfrLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025