UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FO8BZwWgFlSPlizvPwqVEQjLqmA5VBpuZNSi/VUuS9w='
WHERE
key_id = 'a3b62a9027f2e6a03689e6ffa55d025c64195c80d914f6165470235d5cea662e'
AND (
token = 'FO8BZwWgFlSPlizvPwqVEQjLqmA5VBpuZNSi/VUuS9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)