UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd4PyS2Z+l1SYyz1F4D9HIm9QHS92lngSmiUQexBorWo='
WHERE
key_id = 'c3f4ad219600dfdef5c689546c59c9d2801488a9a04a6c84d7c3458a9194fa04'
AND (
token = 'd4PyS2Z+l1SYyz1F4D9HIm9QHS92lngSmiUQexBorWo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)