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