UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IrUFjLCB8shQMZT1zXu1LbUFGfDalW3aTsYmBYguLKI=' 
WHERE 
  key_id = 'f796b557d2b77e71a4e9f6592fbdc32951edcb819f1317d565141f06294b9fdd' 
  AND (
    token = 'IrUFjLCB8shQMZT1zXu1LbUFGfDalW3aTsYmBYguLKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038