UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yxg4XNEPaPJXVegE6dUN+LH3cs4eQed7GUO3ceOxqXs=' 
WHERE 
  key_id = '2de092591d0b265cbaae39c9f324c877f77f783a2f06a89638885f2616300dce' 
  AND (
    token = 'Yxg4XNEPaPJXVegE6dUN+LH3cs4eQed7GUO3ceOxqXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047