UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EHNTE9knDWyD5lCqAmMHF2Y4QTmwe0kk/4eVtOK5+Ak='
WHERE
key_id = '8e8bcad7804a48934d380c740e42a380fce9e851b833a63ff5ba544ce9bcff4e'
AND (
token = 'EHNTE9knDWyD5lCqAmMHF2Y4QTmwe0kk/4eVtOK5+Ak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)