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