UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nVrIdZL+01+neHgGc9rON7T3mZhE6ks7uOQ9PYDhM4E='
WHERE
key_id = '118905eba6526dcafba9527b9f47a87347c6d1ae8a48f76a95906f2d8733430a'
AND (
token = 'nVrIdZL+01+neHgGc9rON7T3mZhE6ks7uOQ9PYDhM4E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)