UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b6c6afR9sQ3SDGiCiXQPeP8u0Zn5df64J/QVtH7yra0='
WHERE
key_id = 'a2af5c1340eaab4e5c412e347208afbbb15f48b02531f1718982294f28fdd10d'
AND (
token = 'b6c6afR9sQ3SDGiCiXQPeP8u0Zn5df64J/QVtH7yra0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)