UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g/V1SrcHf6ogM0D3NyKlrUUcsa0ldot+ZTuFPJHjk98='
WHERE
key_id = 'a4e09b079af6fbc871f05d74a7c49c7045494c7547739c19f8d27ee6f3dd55f6'
AND (
token = 'g/V1SrcHf6ogM0D3NyKlrUUcsa0ldot+ZTuFPJHjk98='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)