UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gBh7yr8ttfX767nVvT5D73IBLHrWdyfodFJv+5n0uXo=' 
WHERE 
  key_id = '65abd5c274276ba68b7aaeeed2d64aea0dc84547453a1433484006bc86a41ca1' 
  AND (
    token = 'gBh7yr8ttfX767nVvT5D73IBLHrWdyfodFJv+5n0uXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051