UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+YGWopL6Cjan6WtlVCVIVaPuUb2Dl2zpZonooh2b78k='
WHERE
key_id = '245c23956448dda868a1eb8999f00ca7aebc3f100f57c9e186f1836965b72f49'
AND (
token = '+YGWopL6Cjan6WtlVCVIVaPuUb2Dl2zpZonooh2b78k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)