UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uJMpTlZkJEqn48Xpc5UfZGBAZ7tIb2J5tfZ3bKhq8Kw='
WHERE
key_id = '9a319bcc82d268c6df0760b104ff249419f92e6f951929ba775a7b0fa89bd85e'
AND (
token = 'uJMpTlZkJEqn48Xpc5UfZGBAZ7tIb2J5tfZ3bKhq8Kw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)