UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R5WffBGWjt1ZgcuABkOOlEGFQf58VuSz4xoey3prff8='
WHERE
key_id = '7f87b71d42fa623da87ab1a5d438ae7ea4925b62e49e98876fa7bf1bd685f08d'
AND (
token = 'R5WffBGWjt1ZgcuABkOOlEGFQf58VuSz4xoey3prff8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)