UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ckucf9QRZJ+hFqOky2w2ccaW9wQbyGpvZwi0WMyDUbM='
WHERE
key_id = 'c7c99aa11c86ac0019a8f4a232a4f03794cb5347db56305c41d9357a31f86b34'
AND (
token = 'ckucf9QRZJ+hFqOky2w2ccaW9wQbyGpvZwi0WMyDUbM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)