UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/r+WqN7cn16f1SUeuQ2+e7SrwB3UzKA1zIGz6I2/ps=' 
WHERE 
  key_id = '3a98ee8f868476a86f5b8fdc2a832ba548e6bc49cdccea575a4a8602bbf72cc5' 
  AND (
    token = 'g/r+WqN7cn16f1SUeuQ2+e7SrwB3UzKA1zIGz6I2/ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036