UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5AS6GOVBS55p8vxMkE7RGOfOkmLLVaDUE6hb2z7BSrk='
WHERE
key_id = '1ad7f441f6cd1b85843f2cf352e06307259254f28486620b166a0fff78ce1118'
AND (
token = '5AS6GOVBS55p8vxMkE7RGOfOkmLLVaDUE6hb2z7BSrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)