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