UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PDYn8J5R1rhL+BmS1hoW7G8XhH6ouob5DpXSENUQH9c='
WHERE
key_id = 'd82496b3805e5325f2cccef44b85bcfbc69843b973e91777814a453d70cfce5d'
AND (
token = 'PDYn8J5R1rhL+BmS1hoW7G8XhH6ouob5DpXSENUQH9c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)