UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8fcbM9uSOXPzYYP8XVCTp/jkOY/x+iV/JBiW8MqZYk='
WHERE
key_id = '81ca1bd4f8bd80e68462f09397c49650281f33f0ba97f784a7c1aa779614dd83'
AND (
token = 'A8fcbM9uSOXPzYYP8XVCTp/jkOY/x+iV/JBiW8MqZYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)