UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'boobuJsTRD4BC9TCayBjgROYF2qUtonr3wB0uZxugFk='
WHERE
key_id = '377d38328a3e830e70b2ef2f8022e2b2d17f4e4ff4fdf6c184b313dfebe408ee'
AND (
token = 'boobuJsTRD4BC9TCayBjgROYF2qUtonr3wB0uZxugFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)