UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TnCcYVi9NHtYONfOSbqkqkgU3dNFXtFSbgmyGsaj9Lk='
WHERE
key_id = 'e3390b3d4d04910cbff185ef1f7486f4b60974600757fc4fbf12cd73639d80c7'
AND (
token = 'TnCcYVi9NHtYONfOSbqkqkgU3dNFXtFSbgmyGsaj9Lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)