UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g1WjUY5CUrPG9GPCT8i2+7LVEoMHgwfFAsPxWP5UcsA=' 
WHERE 
  key_id = '8502d84c815962eded81c8c295d4201f90e89ff0118740d6a3c4f4ac0d20db28' 
  AND (
    token = 'g1WjUY5CUrPG9GPCT8i2+7LVEoMHgwfFAsPxWP5UcsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039