UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dlkz5zHqPs3SWUpFD9Ziq0OqoKFDk+0eEN4DWXlimnA='
WHERE
key_id = 'fe1b357836178dd2ef71217266e4a459fbbcf435f3a5dbae5d1f38aafc046cff'
AND (
token = 'dlkz5zHqPs3SWUpFD9Ziq0OqoKFDk+0eEN4DWXlimnA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)