UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGr0OwpdOFWziLM7ODIYKV+W/zo0xFzifmKDwCaABqE=' 
WHERE 
  key_id = 'bba3c0d279a847c9734c84af080677b21b207e322e077e67960f7152e0a3139e' 
  AND (
    token = 'WGr0OwpdOFWziLM7ODIYKV+W/zo0xFzifmKDwCaABqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030