UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/7YWlL72Ns58joOcvqdw+rC+uJe0EJxpG+pKgrzAT38='
WHERE
key_id = 'f89370d142e8de8629131cb93c866cdfaf4d3b5627c7aada8d514611b1370b1a'
AND (
token = '/7YWlL72Ns58joOcvqdw+rC+uJe0EJxpG+pKgrzAT38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)