UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GjxQ6COkafBIpZcpIK6hx0Xn3J1KY0UFn0V1TrkW2ds='
WHERE
key_id = '1640937fdb355556b1791f380525b233a5d9b0e4d8d90f199c9f65d2acad8bbd'
AND (
token = 'GjxQ6COkafBIpZcpIK6hx0Xn3J1KY0UFn0V1TrkW2ds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)