UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A3rh9XTvxL17U0+9kuRWziZ3kyjlYRiNf8zaWvrVtCo='
WHERE
key_id = '41bf1c2b85990a572a962a6446a2c7800faf59db5839fdea35ea2d4048f2b0cd'
AND (
token = 'A3rh9XTvxL17U0+9kuRWziZ3kyjlYRiNf8zaWvrVtCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)