UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNk243aMIZW3hgLmUfD+trIHVb1ZRZlyBieKBZIx/Ns=' 
WHERE 
  key_id = '1badea4124a7de51c271632917e64032ae76b91adfe8a196b0f43f35a1bf1059' 
  AND (
    token = 'TNk243aMIZW3hgLmUfD+trIHVb1ZRZlyBieKBZIx/Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064