UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T4aR1QiYVMvX0Qd8Xo2xR1nTVW2y8xevFJ2RjUAn3vk='
WHERE
key_id = 'c077f3db66b7ddf7c64ed7d34db90ba1226d93b382210c267de64d546de58c50'
AND (
token = 'T4aR1QiYVMvX0Qd8Xo2xR1nTVW2y8xevFJ2RjUAn3vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)