UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DbSaXY82xSODE10TPvnOlXWbdKEdjJ7/4V2ETqKxm7E='
WHERE
key_id = 'cea95b9b137cafb23aaee5d3a3d99dd95619c352f74520c145dffaee3035b59a'
AND (
token = 'DbSaXY82xSODE10TPvnOlXWbdKEdjJ7/4V2ETqKxm7E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)