UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5rbiJHSphzgFyNBgeaJeQR+fSydE0Tg/Thj12L7RC9I='
WHERE
key_id = '916f2f94f9afafa798c36188d80be2f00181626df54b91695da9ea72c398166c'
AND (
token = '5rbiJHSphzgFyNBgeaJeQR+fSydE0Tg/Thj12L7RC9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)