UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FM0hwb4Wgw/JTfC6bEM2ATgnuazw1VNU1KPWrdI9UUk=' 
WHERE 
  key_id = '5a9a0c61ec381013f7f0f9378df74274fd7146738f9392688346f10d0a7c5967' 
  AND (
    token = 'FM0hwb4Wgw/JTfC6bEM2ATgnuazw1VNU1KPWrdI9UUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028