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