UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p9P6tdFXiIby1U9F9JeAtuZC1ADQ+sL1JCyOzmYve0E='
WHERE
key_id = 'e7cde8521f46be4f9f8e6a29b16c318b98dc3a0872f67cc329e32bab359daa7c'
AND (
token = 'p9P6tdFXiIby1U9F9JeAtuZC1ADQ+sL1JCyOzmYve0E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)