UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hmYk07W0I0r6YfKn2HHRc+Lo/he0gzxJFnA71fA3tUs='
WHERE
key_id = '0ca9c4395bfc27e5ea9c0331a41c1f0426e12541636891b35f9d4151a945f354'
AND (
token = 'hmYk07W0I0r6YfKn2HHRc+Lo/he0gzxJFnA71fA3tUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)