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