UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7gy9ZxIIqbQMTWx2acv1k5FRU1qwYDF0H+yTMrKlJo='
WHERE
key_id = 'a62aae2d8d773d1100f41e120c6b9419fd935c6589aa168fdd77c1656c5922d5'
AND (
token = 'k7gy9ZxIIqbQMTWx2acv1k5FRU1qwYDF0H+yTMrKlJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)