UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3D4DVqKi7zRWBFYXJiU3XixjR/hVIZbSIEEMD5LjZeE='
WHERE
key_id = 'f9b5894b4583b9b7c0c98fd9952e8577595c16540dde33ff991e08310508ccf3'
AND (
token = '3D4DVqKi7zRWBFYXJiU3XixjR/hVIZbSIEEMD5LjZeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)